using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using Module.Common.Models.Base;
using Module.Common.Models;
using Module.Core.Common;
using Module.Core.DAO;

namespace Module.Core.BusinessLogic
{
    public class MusicManagerBL
	{
		/// <summary>
		/// Saves a record to the MusicManager table.
		/// </summary>
		public static int Insert(MusicManagerInfo musicManagerInfo)
		{
			try
			{
				return new MusicManagerDAO().Insert(musicManagerInfo);
			}
			catch (Exception ex)
			{
				throw;
			}

		}

		/// <summary>
		/// Saves a record to the MusicManager table.
		/// </summary>
        public static void Update(MusicManagerInfo musicManagerInfo)
		{
			try
			{
				new MusicManagerDAO().Update(musicManagerInfo);
			}
			catch (Exception ex)
			{
				throw;
			}

		}

		/// <summary>
		/// Delete a record from the MusicManager table.
		/// </summary>
        public static void Delete(int musicManageId)
		{
			try
			{
				new MusicManagerDAO().Delete(musicManageId);
			}
			catch (Exception ex)
			{
				throw;
			}

		}
        public static void UpdateStatus(int musicManageId, int status)
        {
            try
            {
                new MusicManagerDAO().UpdateStatus(musicManageId,status);
            }
            catch (Exception ex)
            {
                throw;
            }

        }

        public static MusicManagerInfo Select(int musicManageId)
        {
            try
            {
                MusicManagerInfo info = new MusicManagerInfo();
               
                info = new MusicManagerDAO().Select(musicManageId);
                if (info != null)                   
                return info;
                return null;
            }
            catch (Exception ex)
            {
                throw;
            }

        }

        public static int GetCount(string keyword, int status, string zoneId, int musicianId, int singerId, string type, DateTime createOnFrom, DateTime createOnTo, string createdBy)
        {
            try
            {               
                int getCount = 0;                
                getCount = new MusicManagerDAO().GetCount(keyword, status, zoneId, musicianId, singerId, type, createOnFrom, createOnTo, createdBy);
                if (getCount > 0)                    
                return getCount;
                return 0;
            }
            catch (Exception)
            {

                throw;
            }
        }

        public static DataSet ListMusicManagerPage(string keyword, int status, string zoneId, int musiCianId, int singerId, string type, DateTime createOnFrom, DateTime createOnTo, string createdBy, int currPage, int recodperPage, int pageSize, int total, string link)
        {
            try
            {
                DataSet ds = new DataSet();
               
                ds = new MusicManagerDAO().ListMusicManagerPage(keyword, status, zoneId, musiCianId, singerId, type, createOnFrom, createOnTo, createdBy, currPage, recodperPage, pageSize, total, link);
                if (ds != null)                   
                    return ds;
                return null;
            }
            catch (Exception ex)
            {
                throw;
            }

        }

		/// <summary>
		/// Selects all records from the MusicManager table.
		/// </summary>
        public static CHRTList<MusicManagerInfo> SelectAll()
		{
			try
			{
				return new MusicManagerDAO().SelectAll();
			}
			catch (Exception ex)
			{
				throw;
			}

		}
        public static DataTable SearchAll(string keyword, int status, string zoneId, int musicianId, int singerId, int groupMusicId, int from, int to)
        {
            try
            {
                return new MusicManagerDAO().SearchAll(keyword, status,zoneId,musicianId,singerId,groupMusicId, from, to);
            }
            catch (Exception ex)
            {
                throw;
            }

        }
       
       
       
               
        public static void GetMusicManagerLates(string fileNameXML, string pathWriteXML, int lang, int topN, string zoneID, int status, string type,string type1)
        {
            try
            {
                new MusicManagerDAO().GetMusicManagerLates(fileNameXML, pathWriteXML, lang, topN, zoneID, status, type,type1);
            }
            catch (Exception)
            {

                throw;
            }
        }

        

	}
}
